$(function(){
    
    $(document).ready(function() {
        var starttab = window.location.hash;

        $(".tabs").carouFredSel({
            circular: false,
            responsive: true,
            items: {
                visible: 1,
                start: starttab
            },
            width: '100%',
            auto: {
                delay: 400
            },
            pagination: {
                container: '.tab-links',
                anchorBuilder: function( nr ) {
                    return '<li><a href="#"><span>' + $(this).attr('data-title') + '</span></a></li>';
                }
            }
        });
    });
    
    $(document).ready(function() {

        $('#carousel-brand').carouFredSel({
            responsive: true,
            items : {
                visible         : 6,
                width           : 150,
                height          : 150
            },
            direction           : 'left',
            scroll : {
                items           : 1,
                easing          : 'linear',
                duration        : 800,                         
                pauseOnHover    : true
            },
            prev: {
                button          : $('#prev-button'),
                key             : 'left'
            },
            next: {
                button          : $('#next-button'),
                key             : 'right'
            }
        });
    });
    
    $(document).ready(function() {

        $('#carousel-weather').carouFredSel({
            items : {
                visible         : 1,
                width           : 220,
            },
            direction           : 'up',
            scroll : {
                items           : 1,
                easing          : 'linear',
                duration        : 800,                         
                pauseOnHover    : true
            },
            prev: {
                key             : 'left'
            },
            next: {
                key             : 'right'
            }
        });
    });
    
     $(document).ready(function() {

        $('#carousel-news').carouFredSel({
            items : {
                visible         : 1,
                width           : 220,
            },
            direction           : 'up',
            scroll : {
                items           : 1,
                easing          : 'linear',
                duration        : 800,                         
                pauseOnHover    : true
            },
            prev: {
                key             : 'left'
            },
            next: {
                key             : 'right'
            },
            auto: {
                delay: 300
            }
        });
    });
}());

$(function(){
    
    $(document).ready(function() {
        
        $('#search').click(function(e) {
            
			e.preventDefault();
            $('#header-search').slideToggle(100);
            $('#header-search input').focus();
			
        });
        
        $('#show-all-products').click(function(e) {
            
			e.preventDefault();
            $('#drop-down-all-products').slideToggle(100);
            $('#drop-down-all-products').on('mouseleave', function() {
                $(this).slideUp();
            });
        });
        
        // flag class active toggle 
        $('#bg').click(function() {
            $(this).addClass('active');
            $('#en').removeClass('active');
        });
        $('#en').click(function() {
            $(this).addClass('active');
            $('#bg').removeClass('active');
        });
        
        //landing animations
        
        $('#inner-headline-top').delay(400).animate({top: '+=55px'}, 200, function() {
            $('#inner-headline-bottom').animate({top: '+=55px'}, 400);
        });
        
        $('#inner-label-top').delay(1200).animate({left: '0px'}, 300, function() {  
            $('#label-top-triangle').animate({top: '40px'}, 200);       
        });
        
        $('#inner-label-left').delay(1300).animate({right: '0px'}, 300, function() {  
            $('#label-left-triangle').animate({top: '40px'}, 200);
        });
        
        $('#inner-label-right').delay(1400).animate({left: '0px'}, 300, function() {  
            $('#label-right-triangle').animate({top: '3px'}, 200);
        });
        
        
        
    });
}());